package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkPromoFeedback;
import com.htgd.gardenexpo.dao.GeConParkPromoFeedbackDao;
import com.htgd.gardenexpo.service.GeConParkPromoFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkPromoFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 14:15:03
 */
@Service("geConParkPromoFeedbackService")
public class GeConParkPromoFeedbackServiceImpl implements GeConParkPromoFeedbackService {
    @Resource
    private GeConParkPromoFeedbackDao geConParkPromoFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConParkPromoFeedback queryById() {
        return this.geConParkPromoFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkPromoFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConParkPromoFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkPromoFeedback> getinfoByPromoId(int id) {
        return this.geConParkPromoFeedbackDao.getinfoByPromoId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkPromoFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPromoFeedback insert(GeConParkPromoFeedback geConParkPromoFeedback) {
        this.geConParkPromoFeedbackDao.insert(geConParkPromoFeedback);
        return geConParkPromoFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConParkPromoFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkPromoFeedback update(GeConParkPromoFeedback geConParkPromoFeedback) {
        this.geConParkPromoFeedbackDao.update(geConParkPromoFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConParkPromoFeedbackDao.deleteById() > 0;
    }
    @Override
    public boolean deleteByPromoId(int id) {
        return this.geConParkPromoFeedbackDao.deleteByPromoId(id) > 0;
    }
}
